﻿using Abp.Auditing;
using Abp.Authorization.Users;
using Abp.Domain.Entities;
using System.ComponentModel.DataAnnotations;

namespace LeadThing.AbpZeroTemplate.Authorization.Users.Dto
{
    //Mapped to/from User in CustomDtoMapper
    public class UserEditDto : IPassivable
    {
        /// <summary>
        /// Set null to create a new user. Set user's Id to update a user
        /// </summary>
        public long? Id { get; set; }

        [Required]
        [StringLength(User.MaxNameLength)]
        public string Name { get; set; }

        [Required]
        [StringLength(User.MaxSurnameLength)]
        public string Surname { get; set; }

        [Required]
        [StringLength(AbpUserBase.MaxUserNameLength)]
        public string UserName { get; set; }

        [Required]
        [EmailAddress]
        [StringLength(AbpUserBase.MaxEmailAddressLength)]
        public string EmailAddress { get; set; }

        [StringLength(User.MaxPhoneNumberLength)]
        public string PhoneNumber { get; set; }

        // Not used "Required" attribute since empty value is used to 'not change password'
        [StringLength(User.MaxPlainPasswordLength)]
        [DisableAuditing]
        public string Password { get; set; }

        public bool IsActive { get; set; }

        public bool ShouldChangePasswordOnNextLogin { get; set; }

        public virtual bool IsTwoFactorEnabled { get; set; }

        public virtual bool IsLockoutEnabled { get; set; }

        /// <summary>
        /// 镇ID
        /// </summary>
        public virtual int TownID { get; set; }

        /// <summary>
        /// 区ID
        /// </summary>
        public virtual int AreaID { get; set; }

        /// <summary>
        /// 村ID
        /// </summary>
        public virtual int VillageID { get; set; }

        /// <summary>
        /// 文件ID
        /// </summary>
        public virtual int FileID { get; set; }

        /// <summary>
        /// 设备令牌
        /// </summary>
        public string DeviceToken { get; set; }

        /// <summary>
        /// 客户端ID
        /// </summary>
        public string ClientID { get; set; }

        /// <summary>
        /// 用户类型
        /// </summary>
        public string UserType { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        public int SortID { get; set; }

        #region 扩展字段

        public string ImageUrl { get; set; }

        /// <summary>
        /// 监控用户名
        /// </summary>
        public string MonitorUserId { get; set; }

        /// <summary>
        /// 监控密码
        /// </summary>
        public string MonitorPwd { get; set; }

        /// <summary>
        /// 角色名称
        /// </summary>
        public string RoleName { get; set; }

        /// <summary>
        /// 影像ID
        /// </summary>
        public string CameraID { get; set; }

        #endregion 扩展字段
    }
}